<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <demo></demo>
      <async-comp></async-comp>
    </div>
  </body>
  <script src="./node_modules/vue/dist/vue.js"></script>
  <script>
    Vue.component("demo",{
      template:`
        <h1>同步的组件</h1>
      `
    })

    // 第二个参数是 promise 的参数
    Vue.component("async-comp",function(resolve,reject){
      setTimeout(function(){
        // 成功的结果
        resolve({
          template:"<h1>这是一个异步的组件</h1>"
        })
      },3000)
    })
    let vm = new Vue({
      el: "#app",
    });
  </script>
</html>
